package com.zzyl.nursing.controller.member;

import com.zzyl.common.core.domain.AjaxResult;
import com.zzyl.common.core.page.TableDataInfo;
import com.zzyl.serve.domain.NursingProject;
import com.zzyl.serve.service.INursingProjectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/member/orders/project")
public class ProjectController {

    @Autowired
    private INursingProjectService nursingProjectService;

    @GetMapping("/page")
    public TableDataInfo getProjectListByPage(
            String name,
            Integer status,
            @RequestParam(defaultValue = "1") Integer pageNum,
            @RequestParam(defaultValue = "5") Integer pageSize
    ) {
        TableDataInfo<NursingProject> tableDataInfo = nursingProjectService.getProjectListByPage(name, status, pageNum, pageSize);
        return tableDataInfo ;
    }



    @GetMapping("/{id}")
    public AjaxResult getProjectById(@PathVariable Long id) {
        NursingProject project = nursingProjectService.selectNursingProjectById(id);
        return  AjaxResult.success(project);
    }
}
